<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <base href="<%=basePath%>">
    <link rel="stylesheet" href="static/component/pear/css/pear.css" />
    <link rel="stylesheet" href="static/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="static/css/public.css" media="all">
    <style type="text/css">
        .layui-table-cell {
            height: auto;
            line-height: 28px;
        }
    </style>
</head>
<body>
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">类型名称</label>
        <div class="layui-input-block">
            <input style="width: 250px"  type="text" name="relationshipName"   required  lay-verify="required" placeholder="请输入用户名称" autocomplete="off" class="layui-input" value="${relationShip.relationshipName}" />
        </div>
    </div>

    <div class="layui-form-item" style="width: 360px">
        <label class="layui-form-label">所属父类型</label>
        <div class="layui-input-block">
            <select name="pid"  class="layui-input pid">
                <c:forEach items="${relationShipList}" var="relationShipList">
                    <option value="${relationShipList.relationshipId}">${relationShipList.relationshipName}</option>
                </c:forEach>
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">

            <button type="button" class="layui-btn" lay-submit lay-filter="relationShipUpdateForm">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>





<script src="static/component/layui/layui.js"></script>
<script src="static/component/pear/pear.js"></script>

<script>
    layui.use('form',function (){
        var laydate = layui.laydate;
        var $ = layui.jquery;
        var form = layui.form;


        //表单提交事件
        form.on('submit(relationShipUpdateForm)',function (data){
            //发送异步请求修改数据
            $.post('relationShip/addRelationShipTwo',data.field,function (result){
                //回调
                if (result.success){
                    layer.msg(result.msg,{icon:1,time:1000},function(){
                        window.close();
                        parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                        parent.parent.location.reload(); // 父页面刷新
                        parent.layui.table.reload("RelationShipTableFilter");
                    });
                }


            })
        })

    })

</script>
</body>
</html>